<ui:composition xmlns="http://www.w3.org/1999/xhtml"
                xmlns:ui="http://java.sun.com/jsf/facelets"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:p="http://primefaces.org/ui" xmlns:f="http://java.sun.com/jsf/core"
                xmlns:constants="http://www.tuanzi.com/constants/tags"
                template="/templates/template.xhtml">
    <ui:define name="title">公告管理</ui:define>
    <ui:define name="content">
        <h:form>
            <div class="topbar clearfix"
                 style="background: -webkit-linear-gradient(top,#f6f7f9 0,#ebedf0 100%);">
                <p:toolbar>
                    <f:facet name="right">
                        <p:commandButton value="编辑" icon="fa fa-edit"
                                         actionListener="#{announcementInfoBean.changeStatusToEdit}"
                                         process="@this"
                                         update="@form"
                                         rendered="#{announcementInfoBean.isView()}"/>
                        <p:commandButton value="保存" icon="fa fa-save"
                                         actionListener="#{announcementInfoBean.onSave}"
                                         rendered="#{announcementInfoBean.isNotView()}"
                                         update="@form"/>
                        <p:commandButton value="取消" icon="fa fa-reply"
                                         actionListener="#{announcementInfoBean.changeStatusToView}"
                                         rendered="#{announcementInfoBean.isEdit()}"
                                         process="@this"
                                         update="@form"/>
                        <p:button value="返回" icon="fa fa-reply-all" href="#{currentUserBean.back}"></p:button>
                    </f:facet>
                </p:toolbar>
            </div>
            <div class="ui-fluid" style="padding-top: 30px;">
                <div class="ui-g">
                    <div class="ui-g-12">
                        <div class="card">
                            <div class="ui-g">
                                <div class="ui-g-12">
                                    <h3><b>基本信息</b></h3>
                                    <div class="ui-g-2">
                                        <p:outputLabel for="startTime" value="开始时间"/>
                                    </div>
                                    <div class="ui-g-4">
                                        <p:calendar id="startTime" value="#{announcementInfoBean.$.startTime}"
                                                    locale="#{constants:get('LOCALE')}"
                                                    timeZone="#{constants:get('TIME_ZONE')}"
                                                    pattern="#{constants:get('DATETIME_FORMAT')}"
                                                    readonlyInput="true"
                                                    disabled="#{announcementInfoBean.isView()}"/>
                                    </div>
                                    <div class="ui-g-2">
                                        <p:outputLabel for="endTime" value="结束时间"/>
                                    </div>
                                    <div class="ui-g-4">
                                        <p:calendar id="endTime" value="#{announcementInfoBean.$.endTime}"
                                                    locale="#{constants:get('LOCALE')}"
                                                    timeZone="#{constants:get('TIME_ZONE')}"
                                                    pattern="#{constants:get('DATETIME_FORMAT')}"
                                                    readonlyInput="true"
                                                    disabled="#{announcementInfoBean.isView()}"/>
                                    </div>
                                    <div class="ui-g-2">
                                        <p:outputLabel for="title" value="标题"/>
                                    </div>
                                    <div class="ui-g-4">
                                        <p:inputText id="title" value="#{announcementInfoBean.$.title}"
                                                     disabled="#{announcementInfoBean.isView()}"/>
                                    </div>
                                    <div class="ui-g-2">
                                        <p:outputLabel for="sendEmail" value="是否发送邮件"/>
                                    </div>
                                    <div class="ui-g-4">
                                        <p:inputSwitch id="sendEmail" onLabel="是" offLabel="否"
                                                       value="#{announcementInfoBean.$.sendEmail}"
                                                       disabled="#{announcementInfoBean.isView()}"/>
                                    </div>
                                    <div class="ui-g-2">
                                        <p:outputLabel for="content" value="内容"/>
                                    </div>
                                    <div class="ui-g-10">
                                        <p:inputTextarea id="content" value="#{announcementInfoBean.$.content}"
                                                         disabled="#{announcementInfoBean.isView()}" rows="4"/>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </h:form>
    </ui:define>
</ui:composition>